import request from '@/utils/request'

// 查询文件切片列表
export function listFileSegments(fileId, query) {
  return request({
    url: `/knowledge-base/file/${fileId}/segments`,
    method: 'get',
    params: query
  })
}

// 查询切片详细
export function getSegment(id) {
  return request({
    url: `/knowledge-base/file/segment/${id}`,
    method: 'get'
  })
}

// 新增切片
export function addSegment(data) {
  return request({
    url: '/knowledge-base/file/segment',
    method: 'post',
    data: data
  })
}

// 修改切片
export function updateSegment(data) {
  return request({
    url: `/knowledge-base/file/segment/${data.id}`,
    method: 'put',
    data: data
  })
}

// 删除切片
export function delSegment(id) {
  return request({
    url: `/knowledge-base/file/segment/${id}`,
    method: 'delete'
  })
}

// 批量删除切片
export function delSegments(ids) {
  return request({
    url: '/knowledge-base/file/segment/batch',
    method: 'delete',
    data: ids
  })
} 